//
//  @ Project : Project1
//  @ File Name : Player.java
//  @ Date : 1/21/2013
//  @ Author : Graham Tapscott
//
//



/**
 * Player - this class represents a human, player type character.  It is derived from the Creature class. 
 * @author gtapscott
 *
 */
public class Player extends Creature {
	
	// Instance variables
	private Integer age = 0;
	private Integer height = 0;
	private Integer weight = 0;
	
	/***
	 * Player - no-arg constructor
	 */
	public Player() {
		super();
	}
	
	/**
	 * Player - argumented constructor, this can be used to instantiate a new object from a 
	 * string representation of the object
	 * @param input a string representation of the object
	 */
	public Player(String[] input) {
		this();
		deSerialize(input);
	}

	/***
	 * getAge - age variable getter
	 * @return the age
	 */
	public Integer getAge() {
		return age;
	}

	/***
	 * setAge - age variable setter
	 * @param age the age to set
	 */
	public void setAge(Integer age) {
		this.age = age;
	}

	/***
	 * height - height variable getter
	 * @return the height
	 */
	public Integer getHeight() {
		return height;
	}

	/***
	 * setHeight - height variable setter
	 * @param height the height to set
	 */
	public void setHeight(Integer height) {
		this.height = height;
	}

	/***
	 * getWeight - weight variable getter
	 * @return the weight
	 */
	public Integer getWeight() {
		return weight;
	}

	/***
	 * setWeight - weight variable setter
	 * @param weight the weight to set
	 */
	public void setWeight(Integer weight) {
		this.weight = weight;
	}

	public String dumpObject(){
		String result = this.serialize() + Utils.newLine;
		for(int i=0;i<treasureList.size();i++){
			result += Utils.tabChar + treasureList.get(i).toString() + Utils.newLine;
		}
		for(int i=0;i<artifactsList.size();i++){
			result += Utils.tabChar + artifactsList.get(i).toString() + Utils.newLine;
		}
		return result;
	}	
	

	/**
	 * See parent class
	 */
	public String toString() {
		String mobile = "c:" + this.index + ":" + this.type + ":" + this.name + ":"
				+ this.partyIndex + ":" + this.empathy + ":" + this.fear + ":"
				+ this.carryCapacity;
		
		return mobile;
	}
	
	/***
	 * See parent class
	 */
	public void deSerialize(String[] mobile) {
		this.index = Integer.parseInt(mobile[1]);
		this.type = mobile[2];
		this.name = mobile[3];
		this.partyIndex = Integer.parseInt(mobile[4]);
		this.empathy = Integer.parseInt(mobile[5]);
		this.fear = Integer.parseInt(mobile[6]);
		this.carryCapacity = Double.parseDouble(mobile[7]);
	}
}
